extends RefCounted


class_name CharacterEvent
"""
角色事件
"""


var type: CharacterUnit.Event = CharacterUnit.Event.NONE
var meta: Dictionary[String, Variant] = {}
var is_canceled: bool = false


func clone(dict: Dictionary[String, Variant] = {}) -> CharacterEvent:
    var e: CharacterEvent = CharacterEvent.new()
    e.type = type
    e.is_canceled = false
    for k in meta:
        e.meta[k] = meta[k]
    for k in dict:
        e.meta[k] = dict[k]
    return e

func to_text() -> String:
    return "%s:%s %s" % [CharacterUnit.EventDesc[type], str(meta), self]

func cancel() -> void:
    is_canceled = true
